home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
games
/
36
/
baspic.doc
< prev
next >
Wrap
Text File
|
1985-11-19
|
4KB
|
81 lines
Picture Show
A picture loader for your ST BASIC programs.
by Mathew Spolin
One of the ST's most powerful features is its easily accessed graphics.
Programs such as Neo-Chrome and DEGAS take full advantage of such graphics to
create excellent picture files. But most people use the pictures they create
only to impress friends and neighbors. Few actually use the pictures they draw
within their own ST BASIC programs, because it's so difficult to load pictures
from BASIC.
Not any more. With the use of Picture Show's self-contained subroutine,
SHOWPIC, loading NEO-Chrome or DEGAS pictures is as simple as defining a
filename and calling the subroutine with a simple GOSUB.
Using Picture Show.
Use Xmodem to download Listing 1 from the database here on Delphi. If you're
using the RAM version of TOS, you may need to disable buffered graphics in
order to utilize the program. Lines 10-140 are part of the demo program driver
and are not needed in order to use the subroutine. The actual Showpic
subroutine begins at Line 64000.
To use Picture Show within your own programs, combine the subroutine with your
main program by using the MERGE command. Then, whenever you wish to display a
picture, define FILE$ with the name of the picture you wish to display. The
picture may be either NEO-Chrome or DEGAS, but don't forget to include the
extension. Also, be sure the screen is in the same resolution mode as the
picture you're attempting to load. If not, the picture won't appear clearly on
the screen.
Once the filename is defined, call the subroutine with a GOSUB SHOWPIC
statement. The screen will clear, the mouse pointer will disappear, and your
picture will be loaded into screen memory. The subroutine will then wait for
the left mouse button to be pressed. When this happens, Picture Show will clear
the screen, restore the mouse pointer and return control to the main program.
How it works.
Picture Show is a series of GEM and VDI calls, combined with a BLOAD command
and some color palette handling code. In a nutshell, variables are defined and
redimensioned in Lines 64010 and 64020. The color palette is then saved in the
variable PAL% in Lines 64030 and 64040. Then, in Lines 64050 through 64070, the
picture type is determined and variables are set as to the header lengths of
the two types of pictures.
The VDI routine Hide_Pointer, called at Line 64080, hides the mouse pointer so
it won't spoil the picture. Then, at Lines 64090 through 64110, the new color
palette is loaded in and changed. Line 64110 also calls a VDI routine called
Clear_Workstation, which clears the entire screen, including the menu bar.
This done, the actual picture is loaded into screen RAM at Line 64120. The AES
routine, known as Mouse_Event, called at Line 64130, waits for the left mouse
button to be pressed. The POKE statement at Line 64140 resets the palette to
its original colors. At Line 64150, the screen is again cleared and, through
Line 64160, the VDI routine Show_Mouse is called, which restores the pointer to
the screen. Finally, Line 64170 sends control back to the main program.
You may notice that, even though ST BASIC will redraw the windows, the menu
bar remains blank and the menu still functions as usual. This is because,
although AES routine Create_Menu (used to make all ST menu bars) draws and
maintains a new menu, it never updates the menu bar. However, this has no
effect on the menu functions.
So, next time you need a really elaborate title page, or need to load a game
background, utilize those stunning graphics available to your ST...from BASIC!
Author's Biography:
Mathew Spolin has been writing computer programs for six years and works in
BASIC, Action!, C and 6502 assembly language. He currently enjoys writing
programs on his 520ST, while his 130XE runs his bulletin board system, the
Towers of Darkness BBS, at (301) 656-3401.
ə